package br.edu.fapi.gestao.pg.repositorio;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import br.edu.fapi.gestao.pg.dominio.Monitor;
import br.edu.fapi.gestao.pg.mapeador.MapeadorMonitor;

@Repository(value = "repositorioMonitor")
public class RepositorioMonitorImpl {

	@Autowired
	private JdbcTemplate jdbcTemplate;
					  
	@Resource(name = "consultasMonitor")
	private Map<String,String> sqlQueries;
	
	@Resource(name = "mapeadorMonitor")
	private MapeadorMonitor mapeadorMonitor;
	
	public List<Monitor> validarUsuario(String usuario, String senha) {
		String sqlString = sqlQueries.get("validarMonitor");
		return jdbcTemplate.query(sqlString, mapeadorMonitor, new Object[]{usuario, senha, senha});
	}

}
